package com.ctg.behavior.calc.common;

import java.util.HashMap;
import java.util.Map;

public class CtRequestParam {

	private Map<String, Object> params = new HashMap<>();

	public void addParam(String key, Object value) {
		params.put(key, value);
	}

	public Object getParam(String key) {
		return params.get(key);
	}

	public String getParamString(String key) {
		Object value = this.getParam(key);
		if (value == null) {
			return null;
		}
		return String.valueOf(value);
	}

	public Integer getParamInteger(String key) {
		Object value = this.getParam(key);
		if (value == null) {
			return null;
		}
		return Integer.parseInt((String) value);
	}

	public Long getParamLong(String key) {
		Object value = this.getParam(key);
		if (value == null) {
			return null;
		}
		return Long.parseLong((String) value);
	}

	public Boolean getParamBoolean(String key) {
		Object value = this.getParam(key);
		if (value == null) {
			return null;
		}
		return Boolean.parseBoolean((String) value);
	}

}
